//Source file: D:\\WTK104\\apps\\Toddtris\\src\\com\\toddsoft\\toddtris\\model\\WellListenerList.java

package com.toddsoft.toddtris.model;

public class WellListenerList implements WellListener {

    private WellListener[] listeners = new WellListener[0];
    
    WellListenerList() {
     
    }
    
    /**
     * @param listener
     */
    synchronized void addListener(WellListener listener) {
        /* increase size of array */
        WellListener[] temp = new WellListener[listeners.length + 1];
        System.arraycopy(listeners, 0, temp, 0, listeners.length);
        listeners = temp;

        /* add the listener */
        listeners[listeners.length - 1] = listener;
    }
    
    /**
     * @param well
     */
    public void wellChanged(Well well) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].wellChanged(well);
        }     
    }
    
    /**
     * @param well
     * @param linesMade
     */
    public void madeLines(Well well, int linesMade) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].madeLines(well, linesMade);
        }     
    }
    
    /**
     * @param well
     */
    public void gameOver(Well well) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].gameOver(well);
        }     
    }
    
    /**
     * @param well
     */
    public void wellReset(Well well) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].wellReset(well);
        }     
    }
    
    /**
     * @param well
     */
    public void blockLanded(Well well) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].blockLanded(well);
        }     
    }
    
    /**
     * @param well
     */
    public void complete(Well well) {
        for (int i = 0; i < listeners.length; i++) {
            listeners[i].complete(well);
        }     
    }
}
